import type { HomeBrand, HomeBrandPageDto } from '@/models/homeBrand'
import type { CommonResult, CommonPage } from '@/models/request'
import request, { ContentTypeEnum } from '@/utils/request'
export function fetchList(params: HomeBrandPageDto) {
  return request<CommonPage<HomeBrand>>({
    url: '/home/brand/list',
    method: 'get',
    params: params,
  })
}

export function updateRecommendStatus(data: { ids: string; recommendStatus: number }) {
  return request<CommonResult>({
    url: '/home/brand/update/recommendStatus',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function deleteHomeBrand(data: { ids: string }) {
  return request<CommonResult>({
    url: '/home/brand/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function createHomeBrand(data: HomeBrand[]) {
  return request<CommonResult>({
    url: '/home/brand/create',
    method: 'post',
    data: data,
  })
}

export function updateHomeBrandSort(params: { id?: number; sort?: number }) {
  return request<CommonResult>({
    url: '/home/brand/update/sort/' + params.id,
    method: 'post',
    params: params,
  })
}
